home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 566 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  973 b 

  1. Path: solon.com!not-for-mail
  2. From: dickey@clark.net (T.E.Dickey)
  3. Newsgroups: comp.lang.c.moderated,comp.std.c
  4. Subject: Re: 'h' modifier in printf
  5. Followup-To: comp.lang.c.moderated,comp.std.c
  6. Date: 14 Mar 1996 08:20:28 -0600
  7. Organization: Clark Internet Services, Inc., Ellicott City, MD USA
  8. Sender: clc@solutions.solon.com
  9. Approved: clc@solutions.solon.com
  10. Message-ID: <4i99vc$91r@solutions.solon.com>
  11. References: <4i801c$455@solutions.solon.com>
  12. NNTP-Posting-Host: solutions.solon.com
  13. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  14.  
  15. Michael J Zehr (tada@athena.mit.edu) wrote:
  16. : The "h" modifier says the corresponding argument will be printed as a
  17. : short or unsigned short.
  18. ...
  19. : short s;
  20. : printf("%d", s);
  21. : printf("%hd", s);
  22. ... 
  23. : Can these two ever be different?  I'm aware of course that the short is
  24. : widened to an int during the function call, but this preserves the
  25. : value.
  26. sure can -- you're overlooking sign extension
  27.  
  28.  
  29. -- 
  30. Thomas E. Dickey
  31. dickey@clark.net
  32.